package com.jx.jingxuan.controller.home;

import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.jx.jingxuan.autolayout.AutoUtils;

/**
 * <li>Package:com.jx.jingxuan.controller.home</li>
 * <li>Author: Administrator  </li>
 * <li>Date: 2019/3/19</li>
 * <li>Description:   </li>
 */
public class HomeBaoItemDecoration extends RecyclerView.ItemDecoration {
    @Override
    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
        super.getItemOffsets(outRect, view, parent, state);
        if (parent.getChildAdapterPosition(view) == 0) {
            outRect.left = AutoUtils.getPercentWidthSizeBigger(10);
        } else if (parent.getChildAdapterPosition(view) == state.getItemCount() - 1) {
            outRect.left = AutoUtils.getPercentWidthSizeBigger(6);
            outRect.right = AutoUtils.getPercentWidthSizeBigger(10);
        } else {
            outRect.left = AutoUtils.getPercentWidthSizeBigger(6);
        }
    }
}
